<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"><title>kiloGrand - Blog</title><meta name="keywords" content="kiloGrand"><meta name="author" content="kiloGrand"><meta name="copyright" content="kiloGrand"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="Studing Record">
<meta property="og:type" content="website">
<meta property="og:title" content="kiloGrand">
<meta property="og:url" content="https://kilogrand.gitee.io/page/2/index.html">
<meta property="og:site_name" content="kiloGrand">
<meta property="og:description" content="Studing Record">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://kilogrand.gitee.io/img/profile.png">
<meta property="article:author" content="kiloGrand">
<meta property="article:tag" content="kiloGrand">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://kilogrand.gitee.io/img/profile.png"><link rel="shortcut icon" href="/img/favicon.png"><link rel="canonical" href="https://kilogrand.gitee.io/page/2/"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6/css/all.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.css" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = { 
  root: '/',
  algolia: undefined,
  localSearch: {"path":"/search.xml","preload":false,"languages":{"hits_empty":"找不到您查询的内容：${query}"}},
  translate: undefined,
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '',
  date_suffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: undefined,
  source: {
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery@2/dist/fjGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery@2/dist/fjGallery.min.css'
    }
  },
  isPhotoFigcaption: false,
  islazyload: false,
  isAnchor: true
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: 'kiloGrand',
  isPost: false,
  isHome: true,
  isHighlightShrink: false,
  isToc: false,
  postUpdate: '2023-05-14 00:49:57'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          if (t === 'dark') activateDarkMode()
          else if (t === 'light') activateLightMode()
        
    const detectApple = () => {
      if(/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
        document.documentElement.classList.add('apple')
      }
    }
    detectApple()
    })(window)</script><meta name="generator" content="Hexo 5.4.2"></head><body><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src="/img/profile.png" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="sidebar-site-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">46</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">6</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">5</div></a></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 主页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> Link</span></a></div></div></div></div><div class="page" id="body-wrap"><header class="full_page" id="page-header" style="background-image: url('/img/index.jpg')"><nav id="nav"><span id="blog_name"><a id="site-name" href="/">kiloGrand</a></span><div id="menus"><div id="search-button"><a class="site-page social-icon search"><i class="fas fa-search fa-fw"></i><span> 搜索</span></a></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 主页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> Link</span></a></div></div><div id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="site-info"><h1 id="site-title">kiloGrand</h1></div><div id="scroll-down"><i class="fas fa-angle-down scroll-down-effects"></i></div></header><main class="layout" id="content-inner"><div class="recent-posts" id="recent-posts"><div class="recent-post-item"><div class="recent-post-info no-cover"><a class="article-title" href="/2023/03/15/kuiper_infer-L4/" title="自制深度学习框架--Relu和Layer">自制深度学习框架--Relu和Layer</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2023-03-15T01:41:10.000Z" title="发表于 2023-03-15 09:41:10">2023-03-15</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/%E6%B7%B1%E5%BA%A6%E5%AD%A6%E4%B9%A0/">深度学习</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/tags/kuiper-infer/">kuiper_infer</a></span></div><div class="content">OpType和OperatorOpType采用枚举类enum class，和传统的枚举enum相比，可以降低命名空间的污染、避免发生隐式转换。同时，定义了一个Operator作为父类，其派生类中只存放相关的参数以及修改参数的方法，不包含计算的实现。explicit构造函数是用来防止隐式转换的。
123456789101112131415enum class OpType &#123;  kOperatorUnknown = -1,  kOperatorRelu = 0,  // 后续添加  // kOperatorSigmoid = 1,&#125;;class Operator &#123; public:  explicit Operator(OpType op_type);  virtual ~Operator() = default; public:  OpType kOpType = OpType::kOperatorUnknown;&#125;;
ReluOperatorReluOperator参数只有thresh，同时也定义了两个成员函数用来查看和修改thresh。
12 ...</div></div></div><div class="recent-post-item"><div class="recent-post-info no-cover"><a class="article-title" href="/2023/03/14/kuiper_infer-L3/" title="自制深度学习框架--导入数据">自制深度学习框架--导入数据</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2023-03-14T01:41:10.000Z" title="发表于 2023-03-14 09:41:10">2023-03-14</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/%E6%B7%B1%E5%BA%A6%E5%AD%A6%E4%B9%A0/">深度学习</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/tags/kuiper-infer/">kuiper_infer</a></span></div><div class="content">从CSV文件中初始化Tensor张量类
CSV（逗号分隔值）文件是一种特殊的文件类型，可在 Excel 中创建或编辑。CSV文件采用逗号分隔的形式来存储文本和数字信息，总体来说，这种形式的文件格式具有扩展性好，移植性强的特点。

作用：

对比推理结果
把pytorch的结果输出到csv文件中，KuiperInfer读取，然后再对比


导入模型权值
把pytorch的模型权值输出到csv文件中，KuiperInfer读取，进行推理



接口定义：12345678910class CSVDataLoader &#123; public:  static std::shared_ptr&lt;Tensor&lt;float &gt;&gt; LoadData(const std::string &amp;file_path, char split_char = &#x27;,&#x27;);  static std::shared_ptr&lt;Tensor&lt;float &gt;&gt; LoadDataWithHeader(const std::string &amp;file ...</div></div></div><div class="recent-post-item"><div class="recent-post-info no-cover"><a class="article-title" href="/2023/03/13/kuiper_infer-L2/" title="自制深度学习框架--张量">自制深度学习框架--张量</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2023-03-13T01:41:10.000Z" title="发表于 2023-03-13 09:41:10">2023-03-13</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/%E6%B7%B1%E5%BA%A6%E5%AD%A6%E4%B9%A0/">深度学习</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/tags/kuiper-infer/">kuiper_infer</a></span></div><div class="content">本文以arma::cube为基础实现了Tensor类，提供了更方便的访问方式和对外接口。
Tensor类模板C++类模板例子：12345678910111213141516171819202122232425// 类模板template &lt;typename T1, typename T2&gt; // 或者template&lt;class T1, class T2&gt;class Complex &#123;public:    Complex(T1 a, T2 b) : _a(a), _b(b);    Complex&lt;T1, T2&gt; operator+(Complex&lt;T1, T2&gt; &amp;c);private:    T1 _a;    T2 _b;&#125;;// 类模板-全特化（具体化）template &lt;&gt;class Complex&lt;int, int&gt; &#123;public:    Complex(int a, int b) : _a(a), _b(b);    Complex&lt;int, int&gt ...</div></div></div><div class="recent-post-item"><div class="recent-post-info no-cover"><a class="article-title" href="/2023/02/26/tuning_playbook-zh_cn/" title="深度学习调优指南中文版">深度学习调优指南中文版</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2023-02-26T01:41:10.000Z" title="发表于 2023-02-26 09:41:10">2023-02-26</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/%E6%B7%B1%E5%BA%A6%E5%AD%A6%E4%B9%A0/">深度学习</a></span></div><div class="content">深度学习调优指南中文版这不是官方认证的 Google 产品。
Varun Godbole † , George E. Dahl † , Justin Gilmer † , Christopher J. Shallue ‡ , Zachary Nado †
† 谷歌研究，谷歌大脑团队
‡ 哈佛大学
目录
这份手册是为谁准备的？
为什么需要这份调优手册？
开始新项目的指南
选择模型架构
选择优化器
选择BatchSize
选择初始配置


提高模型性能的科学方法
增量调整策略
探索与利用
选择下一轮实验的目标
设计下一轮实验
确定是否采用此训练工作流更改或超参数配置
探索结束后


确定每次训练运行的步数
当训练不受计算限制时如何决定该训练多久
当训练受计算限制时如何决定该训练多久


关于训练工作流的额外补充
优化输入管道
评估模型性能
保存检查点并追溯选择最佳检查点
设置实验跟踪
BatchNorm的实现细节
多主机工作流的注意事项


常见问题的回答
致谢
引用
关于贡献

这份手册是为谁准备的？本文档适用于对最大化深度学习的性能感兴趣的工程师和研究人员（包括个人和团队）。我们假定您 ...</div></div></div><div class="recent-post-item"><div class="recent-post-info no-cover"><a class="article-title" href="/2022/10/03/nlp-sentiment-analysis-bert-atsc/" title="BERT在情感分析ATSC子任务的应用">BERT在情感分析ATSC子任务的应用</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2022-10-02T16:41:10.000Z" title="发表于 2022-10-03 00:41:10">2022-10-03</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/NLP/">NLP</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/tags/sentiment-analysis/">sentiment analysis</a></span></div><div class="content">本文主要介绍论文Adapt or Get Left Behind: Domain Adaptation through BERT Language Model Finetuning for Aspect-Target Sentiment Classification及其代码实现。
论文解读Introduction最早的情感分析只是判断文本(可以是一句话或者一段长文本)的情感倾向，但是很多实际应用需要更细粒度的分析，这就出现了Aspect Based Sentiment Analysis (ABSA)任务，不了解的读者可以先参考情感分析简介。ABSA任务有两种方法：ACD+ACSC和ATE+ATSC。
ACD是Aspect Category Detection的缩写，ACSC是Aspect Category Sentiment Classification的缩写。ACD是一个多标签(multi-label)分类问题，一个句子可以同时说多个aspect category。以句子”I love their dumplings”为例，ACD会把它分类为food这个category，而ACSC会 ...</div></div></div><div class="recent-post-item"><div class="recent-post-info no-cover"><a class="article-title" href="/2022/10/02/nlp-sentiment-analysis-survey/" title="情感分析简介">情感分析简介</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2022-10-01T16:41:10.000Z" title="发表于 2022-10-02 00:41:10">2022-10-02</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/NLP/">NLP</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/tags/sentiment-analysis/">sentiment analysis</a></span></div><div class="content">本文是对情感分析这个问题(领域)的调研，对于问题的定义和介绍主要参考了Sentiment Analysis: mining sentiments, opinions, and emotions，虽然这本书写于2015年，很多当时SOTA的方法现在已经过时了，但是本书对于问题的介绍和描述非常详细和清晰，强烈建议对情感分析领域有兴趣的读者阅读。
简介术语解释情感分析(sentiment analysis)，也叫作观点挖掘(opinion mining)，它的研究问题是分析人们通过文本表达的对某个实体(entity)的观点(opinion)、情感(sentiment)、评价(appraisal)、态度(attitude)和情绪(emotion)。这里的实体可以是产品、服务、组织机构、个人、事件和各种话题。除了sentiment analysis之外，在学术界还有很多类似的术语，包括观点挖掘(opinion mining)、观点分析(opinion analysis)、观点抽取(opinion extraction)、情感挖掘(sentiment mining)、主(客)观分析(subject ...</div></div></div><div class="recent-post-item"><div class="recent-post-info no-cover"><a class="article-title" href="/2022/10/01/nlp-sentiment-analysis-dataset/" title="情感分析常见数据集介绍">情感分析常见数据集介绍</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2022-09-30T16:41:10.000Z" title="发表于 2022-10-01 00:41:10">2022-10-01</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/NLP/">NLP</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/tags/sentiment-analysis/">sentiment analysis</a></span></div><div class="content">本文介绍情感分析领域最常见的一些数据集。
SemEvalSemEval-2014 Task 4: Aspect Based Sentiment Analysis任务的介绍主要参考了SemEval-2014 Task 4: Aspect Based Sentiment Analysis，官方网站为SemEval-2014 Task 4。
这是SemEval-2014语义评测任务的第4个任务，它又包含4个子任务。
子任务1：Aspect term extraction给定针对某个entity(比如餐馆)的一些句子，识别其中的aspect term。比如句子”The food was nothing much, but I loved the staff”，我们需要识别”food”和”staff”这两个aspect term。一个句子里可能会出现多个(或者零个)aspect term。另外aspect term可能包含多个词，比如”The hard disk is very noisy”，这里的aspect term是”hard disk”。
子任务2：Aspect term的极性分类给定一 ...</div></div></div><div class="recent-post-item"><div class="recent-post-info no-cover"><a class="article-title" href="/2022/09/11/xv6-questions/" title="xv6问题集合">xv6问题集合</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2022-09-11T12:41:10.000Z" title="发表于 2022-09-11 20:41:10">2022-09-11</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/%E6%93%8D%E4%BD%9C%E7%B3%BB%E7%BB%9F/">操作系统</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/tags/xv6/">xv6</a></span></div><div class="content">
进程表在哪
进程切换的过程

spinlock
为什么spinlock中可以直接使用了push_off和pop_off来关闭/开启中断，而不需要进入内核？spinlock中使用了push_off和pop_off来关闭/开启中断，这个中断包括外部中断和定时中断吗？如果一个用户进程acquire陷入死循环，那么中断是否永远关闭？如果一个用户进程acquire后还没有release，而另一个进程release锁，并且这两个进程的锁不是同一个，那么中断是否开启了？

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253voidpush_off(void)&#123;  int old = intr_get();  // 获取是否开启中断  // noff: num of interrupts,   intena: interrupts enable  intr_off();  // 关闭中断  if(mycpu()-&gt;noff == 0)  // ...</div></div></div><div class="recent-post-item"><div class="recent-post-info no-cover"><a class="article-title" href="/2022/09/10/xv6-lab11/" title="xv6 实验十一 networking">xv6 实验十一 networking</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2022-09-10T01:41:10.000Z" title="发表于 2022-09-10 09:41:10">2022-09-10</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/%E6%93%8D%E4%BD%9C%E7%B3%BB%E7%BB%9F/">操作系统</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/tags/xv6/">xv6</a></span></div><div class="content">
https://pdos.csail.mit.edu/6.S081/2020/schedule.html
https://pdos.csail.mit.edu/6.S081/2020/labs/net.html

实验的目的是为了让我们实现一个网卡驱动在数据链路层的数据收发函数，该函数的实现需要参考E1000的用户手册来完成。
实现
函数e1000_recv需要注意的地方：

不需要加锁，因为该函数会一次性读取rx_ring上所有的数据，且该函数位于数据链路层，数据链路层还不涉及进程的概念。在读取完数据之后，该函数会调用net_rx函数，将数据送给上层应用。
关于index的理解，在recv函数中，寄存器里保存的index是上次已经被处理过的位置，因此，拿到寄存器里的值后，需要加一移动至下个位置。且本次的数据被送至上层应用之后，会对其mbuf进行清理并申请新的mbuf用于保存下次接收的数据。




函数e1000_transmit需要注意的地方：

该相关寄存器中保存的index值为本次需要处理的数据索引，因此，本次处理完之后，需要对该值加一并重新放入寄存器。



1234567 ...</div></div></div><div class="recent-post-item"><div class="recent-post-info no-cover"><a class="article-title" href="/2022/09/09/xv6-lab10/" title="xv6 实验十 mmap">xv6 实验十 mmap</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2022-09-09T01:41:10.000Z" title="发表于 2022-09-09 09:41:10">2022-09-09</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/%E6%93%8D%E4%BD%9C%E7%B3%BB%E7%BB%9F/">操作系统</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/tags/xv6/">xv6</a></span></div><div class="content">
https://pdos.csail.mit.edu/6.S081/2020/schedule.html
https://pdos.csail.mit.edu/6.S081/2020/labs/mmap.html

本次实验只需实现简化版的 mmap和munmap

保证 addr 和 offset 都为 0，也即：在虚拟空间中找足够大的连续页面，将 fd 对应文件的前 length 字节存储在里面。
flags 只需考虑 MAP_SHARED 和 MAP_PRIVATE；prot 只需考虑 PROT_WRITE 和 PROT_READ。
允许不同进程把同一个 MAP_SHARED 的文件映射到不同的物理页面上。
munmap 释放的范围保证是一段 mmap 了的空间的开头一段、或结尾一段、或全部，不会从中间挖一个洞出来。

12void *mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset);int munmap(void *addr, size_t len);
定义每个进程的VMA（虚 ...</div></div></div><nav id="pagination"><div class="pagination"><a class="extend prev" rel="prev" href="/"><i class="fas fa-chevron-left fa-fw"></i></a><a class="page-number" href="/">1</a><span class="page-number current">2</span><a class="page-number" href="/page/3/#content-inner">3</a><span class="space">&hellip;</span><a class="page-number" href="/page/5/#content-inner">5</a><a class="extend next" rel="next" href="/page/3/#content-inner"><i class="fas fa-chevron-right fa-fw"></i></a></div></nav></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="is-center"><div class="avatar-img"><img src="/img/profile.png" onerror="this.onerror=null;this.src='/img/friend_404.gif'" alt="avatar"/></div><div class="author-info__name">kiloGrand</div><div class="author-info__description">coder && data-science researcher</div></div><div class="card-info-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">46</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">6</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">5</div></a></div><a id="card-info-btn" target="_blank" rel="noopener" href="https://github.com/kiloGrand/"><i class="fab fa-github"></i><span>Follow Me</span></a></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn fa-shake"></i><span>公告</span></div><div class="announcement_content">This is my Blog</div></div><div class="sticky_layout"><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/2023/03/24/kuiper_infer-L14/" title="自制深度学习框架--实现Yolov5的推理">自制深度学习框架--实现Yolov5的推理</a><time datetime="2023-03-24T12:00:00.000Z" title="发表于 2023-03-24 20:00:00">2023-03-24</time></div></div><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/2023/03/23/kuiper_infer-L13/" title="自制深度学习框架--实现ResNet网络的推理">自制深度学习框架--实现ResNet网络的推理</a><time datetime="2023-03-23T12:00:00.000Z" title="发表于 2023-03-23 20:00:00">2023-03-23</time></div></div><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/2023/03/22/kuiper_infer-L12/" title="自制深度学习框架--算子的执行流程">自制深度学习框架--算子的执行流程</a><time datetime="2023-03-22T12:00:00.000Z" title="发表于 2023-03-22 20:00:00">2023-03-22</time></div></div><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/2023/03/21/kuiper_infer-L11/" title="自制深度学习框架--再探Tensor类并构建计算图的图关系">自制深度学习框架--再探Tensor类并构建计算图的图关系</a><time datetime="2023-03-21T12:00:00.000Z" title="发表于 2023-03-21 20:00:00">2023-03-21</time></div></div><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/2023/03/20/kuiper_infer-L10/" title="自制深度学习框架--Im2Col原理与卷积层的实现">自制深度学习框架--Im2Col原理与卷积层的实现</a><time datetime="2023-03-20T12:00:00.000Z" title="发表于 2023-03-20 20:00:00">2023-03-20</time></div></div></div></div><div class="card-widget card-categories"><div class="item-headline">
            <i class="fas fa-folder-open"></i>
            <span>分类</span>
            
            </div>
            <ul class="card-category-list" id="aside-cat-list">
            <li class="card-category-list-item "><a class="card-category-list-link" href="/categories/NLP/"><span class="card-category-list-name">NLP</span><span class="card-category-list-count">3</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/categories/%E5%85%B6%E4%BB%96/"><span class="card-category-list-name">其他</span><span class="card-category-list-count">2</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/categories/%E5%B5%8C%E5%85%A5%E5%BC%8F/"><span class="card-category-list-name">嵌入式</span><span class="card-category-list-count">1</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/categories/%E6%93%8D%E4%BD%9C%E7%B3%BB%E7%BB%9F/"><span class="card-category-list-name">操作系统</span><span class="card-category-list-count">25</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/categories/%E6%B7%B1%E5%BA%A6%E5%AD%A6%E4%B9%A0/"><span class="card-category-list-name">深度学习</span><span class="card-category-list-count">14</span></a></li>
            </ul></div><div class="card-widget card-tags"><div class="item-headline"><i class="fas fa-tags"></i><span>标签</span></div><div class="card-tag-cloud"><a href="/tags/hexo/" style="font-size: 1.15em; color: rgb(115, 122, 138)">hexo</a><a href="/tags/kuiper-infer/" style="font-size: 1.35em; color: rgb(173, 136, 52)">kuiper_infer</a><a href="/tags/51%E5%8D%95%E7%89%87%E6%9C%BA/" style="font-size: 1.15em; color: rgb(165, 178, 110)">51单片机</a><a href="/tags/sentiment-analysis/" style="font-size: 1.25em; color: rgb(122, 70, 36)">sentiment analysis</a><a href="/tags/python/" style="font-size: 1.15em; color: rgb(166, 6, 200)">python</a><a href="/tags/xv6/" style="font-size: 1.45em; color: rgb(152, 141, 54)">xv6</a></div></div><div class="card-widget card-archives"><div class="item-headline"><i class="fas fa-archive"></i><span>归档</span></div><ul class="card-archive-list"><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2023/03/"><span class="card-archive-list-date">三月 2023</span><span class="card-archive-list-count">13</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2023/02/"><span class="card-archive-list-date">二月 2023</span><span class="card-archive-list-count">1</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2022/10/"><span class="card-archive-list-date">十月 2022</span><span class="card-archive-list-count">3</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2022/09/"><span class="card-archive-list-date">九月 2022</span><span class="card-archive-list-count">12</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2022/08/"><span class="card-archive-list-date">八月 2022</span><span class="card-archive-list-count">13</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2022/05/"><span class="card-archive-list-date">五月 2022</span><span class="card-archive-list-count">1</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2021/08/"><span class="card-archive-list-date">八月 2021</span><span class="card-archive-list-count">1</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2020/08/"><span class="card-archive-list-date">八月 2020</span><span class="card-archive-list-count">2</span></a></li></ul></div><div class="card-widget card-webinfo"><div class="item-headline"><i class="fas fa-chart-line"></i><span>网站资讯</span></div><div class="webinfo"><div class="webinfo-item"><div class="item-name">文章数目 :</div><div class="item-count">46</div></div><div class="webinfo-item"><div class="item-name">本站访客数 :</div><div class="item-count" id="busuanzi_value_site_uv"></div></div><div class="webinfo-item"><div class="item-name">本站总访问量 :</div><div class="item-count" id="busuanzi_value_site_pv"></div></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">&copy;2022 - 2023 By kiloGrand</div><div class="footer_custom_text">Hi, welcome to my blog!</div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button id="go-up" type="button" title="回到顶部"><i class="fas fa-arrow-up"></i></button></div></div><div id="local-search"><div class="search-dialog"><nav class="search-nav"><span class="search-dialog-title">搜索</span><span id="loading-status"></span><button class="search-close-button"><i class="fas fa-times"></i></button></nav><div class="is-center" id="loading-database"><i class="fas fa-spinner fa-pulse"></i><span>  数据库加载中</span></div><div class="search-wrap"><div id="local-search-input"><div class="local-search-box"><input class="local-search-box--input" placeholder="搜索文章" type="text"/></div></div><hr/><div id="local-search-results"></div></div></div><div id="search-mask"></div></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.umd.js"></script><script src="/js/search/local-search.js"></script><div class="js-pjax"></div><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div></body></html>